import React, { Component } from 'react'

export default class App extends Component {
    a = 999
    myref = React.createRef()
    render() {
        return (
            <div>
                {/* 严格模式下容易报错 */}
                字符串:<input ref="mytext" />
                createRef:<input ref={this.myref} />
                <button onClick={() => {
                    console.log('click', this.refs.mytext.value);
                    console.log('click', this.myref.current.value);
                }}>refs准备弃用</button>
                <button onClick={this.handleClick.bind(this)}>bind绑定</button>
                <button onClick={ this.handleClick2}>箭头函数</button>
            </div>
        )
    }


    handleClick() {
        console.log('handleClick2',this)
    }
    handleClick2 = () => {
        console.log('handleClick2',this)
    }
}
